
<div class="row">
    <div class="col-md-12">
        <div class="widget stacked">
            <div class="widget-content">
            <div class="box-body">
                <!-- <div class="row"> -->
                    <div class="col-md-3 col-sm-4">
                        <!-- BOXES are complex enough to move the .box-header around.
                             This is an example of having the box header within the box body -->
                        <div class="box-header">
                            <h3 class="box-title"><i class="icon icon-inbox"></i> <?php echo $this->l('MESSAGES'); ?></h3>
                        </div>
                        <!-- compose message btn -->
                        <a class="btn btn-block btn-primary" data-toggle="modal" href="<?php echo site_url('Patient/Message/write'); ?>"><i class="icon icon-pencil"></i> <?php echo $this->l('Compose Message'); ?></a>
                        <!-- Navigation - folders-->
                        <div style="margin-top: 15px;">
                            <ul class="nav nav-pills nav-stacked">
                                <li class="header"><i class="icon icon-folder-close"></i> <?php echo $this->l('Folders'); ?></li>
                                <li class="<?php echo (isset($_GET['filter_val']) && $_GET['filter_val'] == 'doctor') ? 'active' : ''; ?>"><a href="<?php echo site_url('Patient/Message/?filter_by=sender&filter_val=doctor'); ?>"><i class="icon icon-inbox"></i> <?php echo $this->l('Inbox'); ?></a></li>                               
                                <li class="<?php echo (isset($_GET['filter_val']) && $_GET['filter_val'] == 'patient') ? 'active' :  ''; ?>"><a href="<?php echo site_url('Patient/Message/?filter_by=sender&filter_val=patient'); ?>"><i class="icon icon-mail-forward"></i> <?php echo $this->l('Sent'); ?></a></li>
                                
                            </ul>
                        </div>
                    </div><!-- /.col (LEFT) -->
                    <div class="col-md-9 col-sm-8">
                        <div class="row pad">
                            <div class="col-sm-6">
                                <label style="margin-right: 10px;">
<!--                                    <input type="checkbox" id="check-all"/>-->
                                </label>
                                <!-- Action button -->
                                <div class="btn-group">
                                    
                                </div>

                            </div>
                            <div class="col-sm-6 search-form">
                                <form action="<?php echo base_url('Patient/Message/'); ?>" method="get" class="text-right">
                                    <div id="search" class="col-md-12">
                                        <label class="col-md-4" for="inputquery" style=" line-height: 34px; ">
                                            <?php echo $this->l('Search'); ?>
                                        </label>

                                        <div class="input-group">
                                            <input id="inputquery" class="form-control" type="text" name="q" value="<?php echo $q; ?>" />
                                            <span class="input-group-btn">
                                                <button class="btn btn-primary" type="submit"><?php echo $this->l('Go!'); ?></button>
                                            </span>
                                        </div><!-- /input-group -->
                                    </div>                                                    
                                </form>
                            </div>
                        </div><!-- /.row -->
                        <br/>
                        <div class="table-responsive">
                            <!-- THE MESSAGES -->
                            <table class="table table-bordered">
                                <?php foreach ($items as $item) { ?>
                                <tr <?php  echo $item->readed == 0 ? 'class="warning"':'';  ?>>
                                    <td class="small-col"><input type="checkbox" /></td>
                                    <td class="name"><?php echo $item->doctor_name; ?></td>
                                    <td class="subject"><?php  echo $item->context; ?></td>
                                    <td class="message"><a href="<?php echo site_url('Patient/Message/read/'.$item->id_message) ?>"><?php  echo $item->message; ?></a></td>
                                    <td class="time">
                                        <?php 
                                            $date = date_create_from_format('Y-m-d H:i:s', $item->date_add);
                                            echo date_format($date, 'd F Y').' at ';
                                            echo date_format($date, 'H:i A'); 
                                        ?>
                                    </td>
                                </tr>
                                <?php } ?>
                             </table>
                            <?php //include(((BASEPATH == '/')?'':dirname(BASEPATH)).'/'.APPPATH.'views/Templates/pagination.php'); ?>
                        </div><!-- /.table-responsive -->
                    </div><!-- /.col (RIGHT) -->
                <!--</div> /.row -->
            </div><!-- /.box-body -->
            </div><!-- box-content -->
        </div><!-- /.box -->
    </div><!-- /.col (MAIN) -->
</div>